package com.kedacom.freedomLabel.initdata.bean;

import android.arch.persistence.room.Entity;
import android.arch.persistence.room.PrimaryKey;
import android.support.annotation.NonNull;
import android.text.TextUtils;

import com.kedacom.freedomLabel.excel.IRowRecord;
import com.kedacom.freedomLabel.model.bean.IFirstLetter;
import com.kedacom.freedomLabel.model.db.Converters;
import com.kedacom.freedomLabel.utils.Cn2Spell;
import com.kedacom.freedomLabel.utils.Utils;

/**
 * @author licheng
 * @since 2019/11/20 16:42
 */
@Entity
public class CategoryNewBean extends IFirstLetter {

    @NonNull
    @PrimaryKey(autoGenerate = true)
    private long id;

    private int otherId;
    // 分类名称
    public String name;

    public String price;
    // 创建时间
    public Long createTime;

    // 缩写（拼音首字母）
    public String shortHand;

    public boolean isInit=true;


    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public int getOtherId() {
        return otherId;
    }

    public void setOtherId(int otherId) {
        this.otherId = otherId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public Long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }

    public String getShortHand() {
        return shortHand;
    }

    public void setShortHand(String shortHand) {
        this.shortHand = shortHand;
    }

    @Override
    public String getFirstLetter() {
        if (TextUtils.isEmpty(this.name)) {
            return "#";
        }
        String firstLetter = Cn2Spell.getPinYin(this.name).substring(0, 1).toUpperCase();
        if (!firstLetter.matches("[A-Z]")) {
            return "#";
        }
        return firstLetter;
    }


    public boolean isInit() {
        return isInit;
    }

    public void setInit(boolean init) {
        isInit = init;
    }

    @Override
    public String getItemName() {
        return this.name;
    }


}